<html>
<head><meta charset="utf-8"><title>Miscompilation with target-cpu=znver1 #63959 · t-compiler · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/index.html">t-compiler</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html">Miscompilation with target-cpu=znver1 #63959</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="180801338"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/180801338" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Siavosh Zarrasvand <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#180801338">(Nov 15 2019 at 04:24)</a>:</h4>
<p>Hey, this was pinged to llvm-icebreakers <a href="https://github.com/rust-lang/rust/issues/63959" target="_blank" title="https://github.com/rust-lang/rust/issues/63959">https://github.com/rust-lang/rust/issues/63959</a></p>
<p>I'm happy to take it on, but see my comment. I lack the target CPU on both machines, would that be an issue?</p>



<a name="180815996"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/180815996" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#180815996">(Nov 15 2019 at 09:40)</a>:</h4>
<p>I suspect it will be difficult to do much without the hardware. <span class="user-mention" data-user-id="119009">@eddyb</span> did volunteer to run testcases or dump data on their own hardware ... but still, its probably better for us to focus effort on finding someone with the hardware ...</p>



<a name="180822462"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/180822462" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mati865 <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#180822462">(Nov 15 2019 at 11:16)</a>:</h4>
<p><span class="user-mention" data-user-id="119009">@eddyb</span> was able to reproduce the crash on Intel CPU by cross compiling to Windows and using Wine to run the binary. So it shouldn't be an issue.</p>



<a name="180839301"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/180839301" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Siavosh Zarrasvand <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#180839301">(Nov 15 2019 at 14:56)</a>:</h4>
<p><span class="user-mention" data-user-id="116083">@pnkfelix</span> Fine. If I could suggest some improvements, I would suggest clarifying these things when marking issues for llvm-icebreakers. If people volunteer too many times and are told they cannot due to &lt;random issue&gt; they lose interest. I'm not there yet but there's only so many times you volunteer with non-constructive outcome.</p>



<a name="180839718"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/180839718" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#180839718">(Nov 15 2019 at 15:00)</a>:</h4>
<p><span class="user-mention" data-user-id="247084">@Siavosh Zarrasvand</span> noted</p>



<a name="180841984"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/180841984" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#180841984">(Nov 15 2019 at 15:24)</a>:</h4>
<p>There is a ryzen box on <a href="https://cfarm.tetaneutral.net/news/" target="_blank" title="https://cfarm.tetaneutral.net/news/">https://cfarm.tetaneutral.net/news/</a></p>



<a name="180842008"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/180842008" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#180842008">(Nov 15 2019 at 15:24)</a>:</h4>
<p>if it reproduces with wine, should be good enough</p>



<a name="180844094"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/180844094" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Siavosh Zarrasvand <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#180844094">(Nov 15 2019 at 15:43)</a>:</h4>
<p><span class="user-mention" data-user-id="123586">@nagisa</span> <span class="user-mention" data-user-id="119581">@mati865</span> Seems plausible. I'm happy to take it on but <span class="user-mention" data-user-id="116083">@pnkfelix</span> might know more. I can wait and if you cannot find someone with the hardware, feel free to let me know...</p>



<a name="180844184"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/180844184" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#180844184">(Nov 15 2019 at 15:44)</a>:</h4>
<p>at this point I trust <span class="user-mention" data-user-id="119581">@mati865</span> and <span class="user-mention" data-user-id="123586">@nagisa</span> 's interpretation of things more than my own</p>



<a name="180844220"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/180844220" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#180844220">(Nov 15 2019 at 15:45)</a>:</h4>
<p>(I <del>wasn't</del> am not sure if the reproduction with Wine required running Wine <em>atop</em> a Ryzen box, though...)</p>



<a name="180844242"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/180844242" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Siavosh Zarrasvand <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#180844242">(Nov 15 2019 at 15:45)</a>:</h4>
<blockquote>
<p>at this point I trust <span class="user-mention silent" data-user-id="119581">mati865</span> and <span class="user-mention silent" data-user-id="123586">nagisa</span> 's interpretation of things more than my own</p>
</blockquote>
<p>Oki, cool. First step for me is to reproduce the issue on my hardware then. I will do that during the weekend and let you know how I progress.</p>



<a name="180844274"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/180844274" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#180844274">(Nov 15 2019 at 15:46)</a>:</h4>
<p>best thing might be to ping <span class="user-mention" data-user-id="119009">@eddyb</span> and just ask for clarification, if their notes on the bug do not suffice.</p>



<a name="180844378"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/180844378" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Siavosh Zarrasvand <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#180844378">(Nov 15 2019 at 15:46)</a>:</h4>
<blockquote>
<p>(I <del>wasn't</del> am not sure if the reproduction with Wine required running Wine <em>atop</em> a Ryzen box, though...)</p>
</blockquote>
<p>Yeah, fair point. Hence why I listen, no point wasting effort, as that is even more discouraging.  Let me see if I can reproduce it, I will report back here during the weekend</p>



<a name="180844468"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/180844468" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Siavosh Zarrasvand <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#180844468">(Nov 15 2019 at 15:47)</a>:</h4>
<blockquote>
<p>best thing might be to ping <span class="user-mention silent" data-user-id="119009">eddyb</span> and just ask for clarification, if their notes on the bug do not suffice.</p>
</blockquote>
<p>Also valid, but he would only know if he tried wine on both AMD and intel. If he tried on AMD only he might not know for Intel. I will ask.</p>



<a name="180845802"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/180845802" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mati865 <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#180845802">(Nov 15 2019 at 16:02)</a>:</h4>
<p>I reproduced crash on Ryzen box on both Windows and Wine, eddyb reproduced it using Wine on Intel CPU.<br>
<a href="https://github.com/rust-lang/rust/issues/63959#issuecomment-552219951" target="_blank" title="https://github.com/rust-lang/rust/issues/63959#issuecomment-552219951">https://github.com/rust-lang/rust/issues/63959#issuecomment-552219951</a> isn't totally clear but I thought people would get the point.</p>



<a name="180845845"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/180845845" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mati865 <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#180845845">(Nov 15 2019 at 16:02)</a>:</h4>
<p>Always targeting <code>znver1</code> ofc.</p>



<a name="180846165"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/180846165" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#180846165">(Nov 15 2019 at 16:06)</a>:</h4>
<p>Okay, so: sorry for the confusion on my part <span class="user-mention" data-user-id="247084">@Siavosh Zarrasvand</span> ; it sounds like you should be able to have success on other hardware as long as you have access to Wine.</p>



<a name="180846442"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/180846442" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Siavosh Zarrasvand <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#180846442">(Nov 15 2019 at 16:09)</a>:</h4>
<blockquote>
<p>Okay, so: sorry for the confusion on my part @Siavosh Zarrasvand ; it sounds like you should be able to have success on other hardware as long as you have access to Wine.</p>
</blockquote>
<p>No worries, thank you for doublechecking</p>



<a name="180846807"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/180846807" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mati865 <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#180846807">(Nov 15 2019 at 16:12)</a>:</h4>
<p>I believe it can be reproduced natively on Windows on non Ryzen box as well, at least with <code>windows-gnu</code> target I haven't found specific instructions that would not run on any other "modern" CPU.<br>
So you should be able to use whatever OS and CPU you want but binaries have to be compiled for znver1 CPU and Windows target.</p>



<a name="180872801"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/180872801" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#180872801">(Nov 15 2019 at 21:15)</a>:</h4>
<p>whoops didn't see this thread. I left a comment on the issue</p>



<a name="180934510"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/180934510" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Siavosh Zarrasvand <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#180934510">(Nov 17 2019 at 00:19)</a>:</h4>
<p><span class="user-mention" data-user-id="119009">@eddyb</span>  All good, I'm installing all targets now, will attempt to reproduce after. Do I understand it correctly that znver1 is not really required, but compiling for Windows is, as the miscompilation happens for the windows targets?</p>



<a name="180934513"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/180934513" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#180934513">(Nov 17 2019 at 00:19)</a>:</h4>
<p>"all targets"?</p>



<a name="180934580"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/180934580" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#180934580">(Nov 17 2019 at 00:20)</a>:</h4>
<p><span class="user-mention" data-user-id="247084">@Siavosh Zarrasvand</span> you might not need a "1st generation AMD Ryzen" (i.e. znver1) CPU but you <em>do</em> need to run <code>rustc</code> with <code>-C target-cpu=znver1</code></p>



<a name="180934636"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/180934636" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Siavosh Zarrasvand <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#180934636">(Nov 17 2019 at 00:22)</a>:</h4>
<blockquote>
<p>"all targets"?</p>
</blockquote>
<p>Hahaha, I figured I might as well... probably will need them at some point if I hang around in this channel. Is in <code>rustup target add all</code></p>



<a name="180934638"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/180934638" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#180934638">(Nov 17 2019 at 00:22)</a>:</h4>
<p>the assembly looks very different from other target CPUs, likely due to the different cost tables (which are so different because AMD made Ryzen unlike existing CPUs)</p>



<a name="180934644"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/180934644" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#180934644">(Nov 17 2019 at 00:22)</a>:</h4>
<p><span class="user-mention" data-user-id="247084">@Siavosh Zarrasvand</span> that seems excessive and a waste of your time, you should only add each target you need at a time</p>



<a name="180934645"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/180934645" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Siavosh Zarrasvand <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#180934645">(Nov 17 2019 at 00:22)</a>:</h4>
<p>What is the full compiler command?</p>



<a name="180934654"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/180934654" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Siavosh Zarrasvand <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#180934654">(Nov 17 2019 at 00:23)</a>:</h4>
<blockquote>
<p><span class="user-mention silent" data-user-id="247084">Siavosh Zarrasvand</span> that seems excessive and a waste of your time, you should only add each target you need at a time</p>
</blockquote>
<p>Are they that many?  I thought I'd give it 20 minutes...</p>



<a name="180934663"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/180934663" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#180934663">(Nov 17 2019 at 00:23)</a>:</h4>
<p>every time you update nightly you will have to download probably entire GBs</p>



<a name="180934665"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/180934665" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#180934665">(Nov 17 2019 at 00:23)</a>:</h4>
<p>for no real good reason</p>



<a name="180934706"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/180934706" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Siavosh Zarrasvand <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#180934706">(Nov 17 2019 at 00:24)</a>:</h4>
<p>Omg...</p>



<a name="180934714"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/180934714" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Siavosh Zarrasvand <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#180934714">(Nov 17 2019 at 00:24)</a>:</h4>
<p>oki, I will have to remove them. Can I abort, clean and add targets again?</p>



<a name="180934722"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/180934722" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#180934722">(Nov 17 2019 at 00:24)</a>:</h4>
<p>I think you can just Ctrl+C it yeah</p>



<a name="180934727"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/180934727" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#180934727">(Nov 17 2019 at 00:24)</a>:</h4>
<p>run <code>rustup target list</code></p>



<a name="180934735"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/180934735" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#180934735">(Nov 17 2019 at 00:25)</a>:</h4>
<p>it will tell you which ones are installed</p>



<a name="180934741"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/180934741" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#180934741">(Nov 17 2019 at 00:25)</a>:</h4>
<p>there are 89 targets in total (listed for me)</p>



<a name="180934792"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/180934792" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#180934792">(Nov 17 2019 at 00:26)</a>:</h4>
<p>I don't actually know how to cross-compile for windows, you might need help from <span class="user-mention" data-user-id="119581">@mati865</span> on that</p>



<a name="180934794"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/180934794" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Siavosh Zarrasvand <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#180934794">(Nov 17 2019 at 00:26)</a>:</h4>
<p>Yeah, removing now. </p>
<p>Which triple do I need to reproduce the error?</p>



<a name="180934798"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/180934798" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#180934798">(Nov 17 2019 at 00:26)</a>:</h4>
<p>(I've never tried it, only copied windows binaries from a windows machine to linux and ran wine on it)</p>



<a name="180934804"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/180934804" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#180934804">(Nov 17 2019 at 00:26)</a>:</h4>
<p><code>x86_64-pc-windows-gnu</code> or <code>x86_64-pc-windows-msvc</code></p>



<a name="180934809"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/180934809" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#180934809">(Nov 17 2019 at 00:27)</a>:</h4>
<p>I think both reproduce but I'm not sure which one is easier to cross-compile for</p>



<a name="180934810"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/180934810" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Siavosh Zarrasvand <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#180934810">(Nov 17 2019 at 00:27)</a>:</h4>
<p>Oki, cool, I will try those two</p>



<a name="180935888"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/180935888" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Siavosh Zarrasvand <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#180935888">(Nov 17 2019 at 01:02)</a>:</h4>
<p>This compiles fine <code>cargo rustc --release --target=x86_64-pc-windows-gnu -- -C target-cpu=znver1 -C linker=x86_64-w64-mingw32-gcc</code></p>



<a name="180935890"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/180935890" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Siavosh Zarrasvand <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#180935890">(Nov 17 2019 at 01:02)</a>:</h4>
<p>Am I supposed to get the issue while I compile, or when I run the binary in wine?</p>



<a name="180936384"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/180936384" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Siavosh Zarrasvand <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#180936384">(Nov 17 2019 at 01:19)</a>:</h4>
<p><span class="user-mention" data-user-id="119009">@eddyb</span> How did you manage to get it to crash under wine? Does it mean that you installed Windows binaries for rustup on wine, and compiled using your wine installation of Rust?</p>



<a name="180936452"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/180936452" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Siavosh Zarrasvand <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#180936452">(Nov 17 2019 at 01:21)</a>:</h4>
<p>My cross compilation works, and it runs through wine. But I don't trigger the error <span aria-label="frown" class="emoji emoji-1f641" role="img" title="frown">:frown:</span></p>



<a name="180936943"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/180936943" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#180936943">(Nov 17 2019 at 01:38)</a>:</h4>
<p>when you run the binary</p>



<a name="180936950"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/180936950" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#180936950">(Nov 17 2019 at 01:39)</a>:</h4>
<p><span class="user-mention" data-user-id="247084">@Siavosh Zarrasvand</span> you shouldn't use Cargo, it's just more complicated</p>



<a name="180936994"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/180936994" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#180936994">(Nov 17 2019 at 01:40)</a>:</h4>
<p>adding your flags to my command:</p>
<div class="codehilite"><pre><span></span>rustc main.rs -C opt-level=3 -C codegen-units=1 -C target-cpu=znver1 --edition=2018 --target=x86_64-pc-windows-gnu -C linker=x86_64-w64-mingw32-gc
</pre></div>



<a name="180937005"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/180937005" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#180937005">(Nov 17 2019 at 01:40)</a>:</h4>
<p><span class="user-mention" data-user-id="247084">@Siavosh Zarrasvand</span> oh you should also only use my latest testcase</p>



<a name="180937013"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/180937013" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#180937013">(Nov 17 2019 at 01:41)</a>:</h4>
<p>before I started reducing all of the testcases crash while rustc is running code from a proc macro, so those cannot reproduce except on windows</p>



<a name="180937401"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/180937401" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Siavosh Zarrasvand <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#180937401">(Nov 17 2019 at 01:55)</a>:</h4>
<blockquote>
<p>before I started reducing all of the testcases crash while rustc is running code from a proc macro, so those cannot reproduce except on windows</p>
</blockquote>
<p>I think this is it, right: </p>
<p><code>thread 'main' panicked at 'assertion failed: </code>(left == right)<code>
  left: </code>([1, 1, 1, 1, 1, 1, 1, 1], [2, 2, 2, 2, 2, 2, 2, 2], [3, 3, 3, 3, 3, 3, 3, 3])<code>,
 right: </code>([16, 250, 50, 0, 0, 0, 0, 0], [32, 32, 32, 32, 32, 32, 32, 32], [3, 3, 3, 3, 3, 3, 3, 3])<code>', ./src/main.rs:37:13
note: run with </code>RUST_BACKTRACE=1<code> environment variable to display a backtrace.</code></p>



<a name="180937506"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/180937506" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Siavosh Zarrasvand <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#180937506">(Nov 17 2019 at 01:59)</a>:</h4>
<p>Alright, it is 2 AM here in London. If this is correct, then I continue tomorrow to see if I can debug it <span aria-label="slight smile" class="emoji emoji-1f642" role="img" title="slight smile">:slight_smile:</span></p>



<a name="180937563"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/180937563" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#180937563">(Nov 17 2019 at 02:01)</a>:</h4>
<p><span class="user-mention" data-user-id="247084">@Siavosh Zarrasvand</span> yupp, nice!</p>



<a name="180937616"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/180937616" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#180937616">(Nov 17 2019 at 02:03)</a>:</h4>
<p>I think if you replace <code>-C target-cpu=znver1</code> with <code>-C target-cpu=native</code>, the assertion failure will go away</p>



<a name="180937678"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/180937678" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#180937678">(Nov 17 2019 at 02:05)</a>:</h4>
<p><span class="user-mention" data-user-id="247084">@Siavosh Zarrasvand</span> btw, on github, you need to put triple backticks (```) on their own lines</p>



<a name="180937794"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/180937794" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Siavosh Zarrasvand <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#180937794">(Nov 17 2019 at 02:09)</a>:</h4>
<blockquote>
<p>I think if you replace <code>-C target-cpu=znver1</code> with <code>-C target-cpu=native</code>, the assertion failure will go away</p>
</blockquote>
<p>That is correct, cpu-target=native will not produce the assertion error. Would be interested to understand how you debugged it to this degree so far <span aria-label="slight smile" class="emoji emoji-1f642" role="img" title="slight smile">:slight_smile:</span></p>



<a name="180937843"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/180937843" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#180937843">(Nov 17 2019 at 02:10)</a>:</h4>
<p>I didn't debug it, I just took the code and reduced it while keeping it crashing (and then later switched to an assertion failure)</p>



<a name="180937856"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/180937856" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#180937856">(Nov 17 2019 at 02:11)</a>:</h4>
<p>oh and if I haven't mentioned this already, the optimized LLVM IR doesn't seem to differ much between windows and linux, but the assembly does, by a lot, because of windows calling conventions, I think</p>



<a name="180937975"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/180937975" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Siavosh Zarrasvand <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#180937975">(Nov 17 2019 at 02:15)</a>:</h4>
<blockquote>
<p>oh and if I haven't mentioned this already, the optimized LLVM IR doesn't seem to differ much between windows and linux, but the assembly does, by a lot, because of windows calling conventions, I think</p>
</blockquote>
<p>Would that not be the case in general, that the assembly is very different? They do compile for different ABIs after all and specially the optimised versions optimize for different OS-level schedulers, maybe? My ASM is a bit rusty (pun intended) so I do not remember how different the results should be.</p>



<a name="180938045"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/180938045" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#180938045">(Nov 17 2019 at 02:17)</a>:</h4>
<p>OS schedulers can't have anything to do with userspace code</p>



<a name="180938084"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/180938084" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#180938084">(Nov 17 2019 at 02:18)</a>:</h4>
<p>and the ABIs typically only affect function prologue/epilogue</p>



<a name="180938089"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/180938089" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#180938089">(Nov 17 2019 at 02:18)</a>:</h4>
<p>the only reason the difference is so big here is the heavy use of SIMD, I think</p>



<a name="180938093"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/180938093" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#180938093">(Nov 17 2019 at 02:18)</a>:</h4>
<p>(that's also why those types have to be so big, so that LLVM uses a lot of SIMD instructions to move data around)</p>



<a name="180938101"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/180938101" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Siavosh Zarrasvand <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#180938101">(Nov 17 2019 at 02:19)</a>:</h4>
<blockquote>
<p>OS schedulers can't have anything to do with userspace code</p>
</blockquote>
<p>What I meant was that at compile time, the strategies of how to lay out the ASM could be different based on which scheduler the compiler is tasked to optimize for.</p>



<a name="180938156"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/180938156" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#180938156">(Nov 17 2019 at 02:20)</a>:</h4>
<p>nope</p>



<a name="180938172"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/180938172" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#180938172">(Nov 17 2019 at 02:21)</a>:</h4>
<p>what <em>is</em> being optimized for is CPU microarchitectural details, like how many instructions of a certain category can be executed in parallel, how many cycles an instruction is expected to take, etc.</p>



<a name="180938217"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/180938217" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#180938217">(Nov 17 2019 at 02:22)</a>:</h4>
<p>the OS primarily only affects ABI (including exception handling, which can be pretty different between linux and windows)</p>



<a name="180938227"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/180938227" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#180938227">(Nov 17 2019 at 02:23)</a>:</h4>
<p>I was hoping I'd find a simple explanation so I went and searched for all mentions of windows in LLVM's X86 target</p>



<a name="180938273"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/180938273" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#180938273">(Nov 17 2019 at 02:24)</a>:</h4>
<p>and there isn't anything noticeable. looking at the assembly, the SIMD usage differs and that can totally be just from the ABI register assignment</p>



<a name="181050075"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181050075" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Siavosh Zarrasvand <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181050075">(Nov 18 2019 at 19:57)</a>:</h4>
<p>Quick update on this, I've been preoccupied since where we left it during the weekend. I intend to pick it up again before Friday, ideally by compiling a couple of similar binaries for different cpu-targets, and then use gdb or IDA Pro to debug my way through the binaries and understand the ASM-level difference  between them. Then post a gist about that and wait for feedback. </p>
<p>Does this sounds like a way forward?</p>



<a name="181116797"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181116797" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181116797">(Nov 19 2019 at 14:41)</a>:</h4>
<p>Is our current goal to try to continue reducing the test case?</p>



<a name="181116959"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181116959" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181116959">(Nov 19 2019 at 14:42)</a>:</h4>
<p>in particular, have we learned enough to be able to be pretty sure that this is an LLVM bug; i.e. something that we might be able to translate to C or LLVM assembly?</p>



<a name="181117656"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181117656" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181117656">(Nov 19 2019 at 14:49)</a>:</h4>
<p>at least, that's how I interpreted eddyb's <a href="https://github.com/rust-lang/rust/issues/63959#issuecomment-554527634" target="_blank" title="https://github.com/rust-lang/rust/issues/63959#issuecomment-554527634">comment here</a>; though its possible <span class="user-mention" data-user-id="119009">@eddyb</span>  actually meant that one could/should trace through the LLVM internals while still driving the test from <code>rustc</code> itself.</p>



<a name="181117847"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181117847" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Siavosh Zarrasvand <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181117847">(Nov 19 2019 at 14:51)</a>:</h4>
<p>From what I have read on the Github thread and here in this channel, we still haven't nailed it down 100%. <span class="user-mention" data-user-id="119009">@eddyb</span> mentioned he had looked at the IR and ASM of files compiled with different CPU targets, and there are some differences but not further analyzed. My proposal is to compile for different targets and track down exactly what happens on the bits and byte levels when it crashes. </p>
<p>In theory, LLVM and the CPU OEM could just blame each other. LLVM manages to create code that compiles for both znver1 and other CPUs, it is when it is executed on znver1 that the crash happens... It's a bit of a chicken and egg situation but the overarching problem seems to me to figure out exactly what happens, and take it from there?</p>
<p>Please correct me if I am wrong.</p>



<a name="181118000"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181118000" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181118000">(Nov 19 2019 at 14:52)</a>:</h4>
<p>Is it at a point where we could throw our generated <code>.bc</code> file(s) into LLVM's <a href="https://llvm.org/docs/CommandGuide/bugpoint.html" target="_blank" title="https://llvm.org/docs/CommandGuide/bugpoint.html"><code>bugpoint</code> tool</a>?</p>



<a name="181118156"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181118156" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Siavosh Zarrasvand <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181118156">(Nov 19 2019 at 14:54)</a>:</h4>
<p>I don't know what .bc files are, and not familiar with bugpoint. I've done exploit development so I would have used IDA Pro and GDB <span aria-label="rolling on the floor laughing" class="emoji emoji-1f923" role="img" title="rolling on the floor laughing">:rolling_on_the_floor_laughing:</span>  Let me read up on those and come back, either with an answer or further questions?</p>



<a name="181118172"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181118172" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181118172">(Nov 19 2019 at 14:54)</a>:</h4>
<p>oh: <code>.bc</code> files are the bitcode files that LLVM generates</p>



<a name="181118239"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181118239" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Siavosh Zarrasvand <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181118239">(Nov 19 2019 at 14:55)</a>:</h4>
<blockquote>
<p>oh: <code>.bc</code> files are the bitcode files that LLVM generates</p>
</blockquote>
<p>Are they same as the IR, Intermediate Representation?</p>



<a name="181118257"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181118257" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181118257">(Nov 19 2019 at 14:55)</a>:</h4>
<p>they are basically a binary file  representation of the low-level internal representation that LLVM uses. (And <code>.ll</code> files are a human-readable (or at least semi-human readable) version of that</p>



<a name="181118299"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181118299" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181118299">(Nov 19 2019 at 14:55)</a>:</h4>
<p>Yeah, <code>.bc</code> files hold LLVM IR</p>



<a name="181118355"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181118355" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181118355">(Nov 19 2019 at 14:56)</a>:</h4>
<p>and you can specify you want <code>.bc</code> output from <code>rustc</code></p>



<a name="181118416"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181118416" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181118416">(Nov 19 2019 at 14:56)</a>:</h4>
<p>I cannot tell whether <code>bugpoint</code> is a good match for this particular bug</p>



<a name="181118448"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181118448" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Siavosh Zarrasvand <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181118448">(Nov 19 2019 at 14:56)</a>:</h4>
<p>In that case, I believe so, yes. We can reliably compile both passing examples for <code>cpu-target=native</code> and failing for <code>cpu-target=znver1</code></p>



<a name="181118451"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181118451" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181118451">(Nov 19 2019 at 14:56)</a>:</h4>
<p>since I do not know/remember how flexible it is with how it automatically runs the test code it compiles as part of its search process.</p>



<a name="181118500"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181118500" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181118500">(Nov 19 2019 at 14:57)</a>:</h4>
<p>i.e. if I understand correctly, you need to run the generated code under Wine in order to observe the bug. I do not know if <code>bugpoint</code> lets one do that (but I <em>hope</em> it does!)</p>



<a name="181118509"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181118509" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Siavosh Zarrasvand <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181118509">(Nov 19 2019 at 14:57)</a>:</h4>
<p>It is worth a shot, the issue is, compilation works fine. It is in the execution that the znver1-targeted binary hicks-up</p>



<a name="181118542"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181118542" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181118542">(Nov 19 2019 at 14:57)</a>:</h4>
<p>Right. <code>bugpoint</code> <em>can</em> handle issues that arise from running the generated code</p>



<a name="181118655"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181118655" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Siavosh Zarrasvand <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181118655">(Nov 19 2019 at 14:58)</a>:</h4>
<blockquote>
<p>i.e. if I understand correctly, you need to run the generated code under Wine in order to observe the bug. I do not know if <code>bugpoint</code> lets one do that (but I <em>hope</em> it does!)</p>
</blockquote>
<p>I will research and give further details here. But if that doesn't work, then I assume we think using GDB and IDA Pro might not be the worst path forward?</p>



<a name="181118675"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181118675" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181118675">(Nov 19 2019 at 14:59)</a>:</h4>
<p>Sure, trying to understand the actual dynamic execution under a debugger isn't a terrible idea</p>



<a name="181118685"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181118685" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Siavosh Zarrasvand <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181118685">(Nov 19 2019 at 14:59)</a>:</h4>
<p>Aha! Lovely!<br>
Thank you, this was highly helpful <span aria-label="slight smile" class="emoji emoji-1f642" role="img" title="slight smile">:slight_smile:</span></p>



<a name="181118695"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181118695" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181118695">(Nov 19 2019 at 14:59)</a>:</h4>
<p>I just figured that we might also learn a lot from finding out which LLVM pass is causing the code's behavior to change</p>



<a name="181118702"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181118702" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181118702">(Nov 19 2019 at 14:59)</a>:</h4>
<p>since presumably it is <em>some</em> optimization ...</p>



<a name="181118806"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181118806" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181118806">(Nov 19 2019 at 15:00)</a>:</h4>
<p>... but the other dangerous thing here is that <span class="user-mention" data-user-id="119009">@eddyb</span> earlier hypothesized that the use of <code>llvm.lifetime.start</code> and <code>llvm.lifetime.end</code> could be related to the problem here</p>



<a name="181118830"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181118830" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181118830">(Nov 19 2019 at 15:00)</a>:</h4>
<p>which brings us back to something I asked near the beginning: If its possible that <em>Rust</em> is generating invalid LLVM IR</p>



<a name="181118935"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181118935" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181118935">(Nov 19 2019 at 15:01)</a>:</h4>
<p>Because if the problem is due to invalid use of <code>llvm.lifetime.start</code> and <code>llvm.lifetime.end</code>, (which are essentially constructs that tell LLVM's optimizers that certain values have reached the end of their dynamic extent and thus optimizations can assume they won't be used), then LLVM will just say "sure, this is a Garbage-In-Garbage-Out scenario."</p>



<a name="181119064"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181119064" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181119064">(Nov 19 2019 at 15:02)</a>:</h4>
<p>unfortunately dissecting that is probably going to require analyzing the use of <code>llvm.lifetime.{start,end}</code> in the generated code.</p>



<a name="181119079"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181119079" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Siavosh Zarrasvand <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181119079">(Nov 19 2019 at 15:03)</a>:</h4>
<p>Interesting, hmm... I guess we figure out. I will keep this in my mind when I am debugging.</p>



<a name="181119110"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181119110" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181119110">(Nov 19 2019 at 15:03)</a>:</h4>
<p>in any case, I'm glad to hear you were able to successfully reproduce the bug locally!</p>



<a name="181124324"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181124324" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181124324">(Nov 19 2019 at 15:50)</a>:</h4>
<p><span class="user-mention" data-user-id="116083">@pnkfelix</span> you'd be right about the llvm.lifetime stuff, except... effectively identical IR doesn't crash when compiled for non-windows or non-znver1</p>



<a name="181124392"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181124392" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181124392">(Nov 19 2019 at 15:51)</a>:</h4>
<p>it just explains why certain aspects of the Rust code influence LLVM <em>at all</em>, but I don't think this is about UB</p>



<a name="181124565"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181124565" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181124565">(Nov 19 2019 at 15:52)</a>:</h4>
<p>LLVM doesn't seem to optimize differently when it outputs a broken executable, it just uses different registers and whatnot</p>



<a name="181124669"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181124669" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181124669">(Nov 19 2019 at 15:53)</a>:</h4>
<p>it's possible someone dedicated enough might be able to reduce the LLVM IR, but it's hard to keep it correct (at least in the Rust code, it being safe is a good metric)</p>



<a name="181124750"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181124750" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181124750">(Nov 19 2019 at 15:54)</a>:</h4>
<p><span class="user-mention" data-user-id="116083">@pnkfelix</span> oh and <code>bugpoint</code> would likely just remove all the checks around the assert and just make LLVM trigger it...</p>



<a name="181124783"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181124783" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181124783">(Nov 19 2019 at 15:54)</a>:</h4>
<p>can you make <code>bugpoint</code> solely reduce the set of LLVM passes, and leave the input source unchanged?</p>



<a name="181124787"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181124787" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181124787">(Nov 19 2019 at 15:54)</a>:</h4>
<p>I haven't seen <code>bugpoint</code> success stories outside of tracking down crashes <em>within</em> LLVM</p>



<a name="181124792"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181124792" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181124792">(Nov 19 2019 at 15:54)</a>:</h4>
<p>interesting, okay</p>



<a name="181124796"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181124796" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181124796">(Nov 19 2019 at 15:54)</a>:</h4>
<p><span class="user-mention" data-user-id="116083">@pnkfelix</span> it's not a LLVM pass</p>



<a name="181124801"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181124801" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181124801">(Nov 19 2019 at 15:54)</a>:</h4>
<p>all of this happens <em>after</em> LLVM IR</p>



<a name="181124844"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181124844" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181124844">(Nov 19 2019 at 15:55)</a>:</h4>
<p>it's mis-instruction-selection not mis-optimization :/</p>



<a name="181124851"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181124851" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181124851">(Nov 19 2019 at 15:55)</a>:</h4>
<p>oh, okay; I had assumed that some LLVM optimization was responsible for part of the transformation at fault.</p>



<a name="181124948"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181124948" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181124948">(Nov 19 2019 at 15:56)</a>:</h4>
<p>there's almost nothing going on just a lot of SIMD copies and the instructions and registers chosen differ between working and broken versions</p>



<a name="181125090"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181125090" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181125090">(Nov 19 2019 at 15:56)</a>:</h4>
<p>I think <span class="user-mention" data-user-id="123586">@nagisa</span> and I looked at something similar (but much simpler than heavy SIMD code) on ARM and it turned out to be something wrong in LLVM's information for an instruction or something like that</p>



<a name="181125103"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181125103" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181125103">(Nov 19 2019 at 15:57)</a>:</h4>
<p><span class="user-mention" data-user-id="119009">@eddyb</span> if you do not think this is about UB, does that mean we might at least be at the point where we could file a bug with LLVM with the generated <code>.bc</code> ?</p>



<a name="181125178"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181125178" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181125178">(Nov 19 2019 at 15:57)</a>:</h4>
<p>well, you almost never want to touch <code>.bc</code>, it's like an unstable compression format for <code>.ll</code> :P</p>



<a name="181125216"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181125216" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Hanna Kruppe <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181125216">(Nov 19 2019 at 15:57)</a>:</h4>
<p>Silly question but did someone try to remove <em>just</em> the lifetime.{start,end} calls from the LLVM IR and see if it still reproduces?</p>



<a name="181125263"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181125263" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181125263">(Nov 19 2019 at 15:58)</a>:</h4>
<p>but we could theoretically submit the <code>.ll</code> - maybe we should replace the panic with something else? like <code>exit(1)</code>?</p>



<a name="181125278"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181125278" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181125278">(Nov 19 2019 at 15:58)</a>:</h4>
<p><span class="user-mention" data-user-id="124289">@rkruppe</span> this is stack corruption bug so if the stack layout is different you can't repro</p>



<a name="181125290"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181125290" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Hanna Kruppe <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181125290">(Nov 19 2019 at 15:58)</a>:</h4>
<p>oh, too bad</p>



<a name="181125323"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181125323" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181125323">(Nov 19 2019 at 15:58)</a>:</h4>
<p>you need weirdly precise sizes of those variables. there's potentially a simpler repro but I'm not aware of it</p>



<a name="181125355"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181125355" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181125355">(Nov 19 2019 at 15:59)</a>:</h4>
<p>You will want it to be reproducible with <code>llc</code> when reporting upstream</p>



<a name="181125385"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181125385" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181125385">(Nov 19 2019 at 15:59)</a>:</h4>
<p>it requires compiling a windows program and ru- wait no</p>



<a name="181125419"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181125419" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181125419">(Nov 19 2019 at 15:59)</a>:</h4>
<p><span class="user-mention" data-user-id="123586">@nagisa</span> how do I link and run a windows target executable, for/on linux?</p>



<a name="181125435"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181125435" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Hanna Kruppe <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181125435">(Nov 19 2019 at 15:59)</a>:</h4>
<p>Getting rid of panic (in favor of exit) seems nice for reducing. But panicking code adds some temporaries on the stack, I think, So it might be difficult to do that while still reproducing, if it's so dependent on the frame layout.</p>



<a name="181125481"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181125481" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181125481">(Nov 19 2019 at 16:00)</a>:</h4>
<p>like I want windows codegen but to call linux libc functions</p>



<a name="181125531"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181125531" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181125531">(Nov 19 2019 at 16:00)</a>:</h4>
<p><span class="user-mention" data-user-id="124289">@rkruppe</span> it's dependent on the layout of the data that's being corrupted (with massive SIMD copies)</p>



<a name="181125547"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181125547" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181125547">(Nov 19 2019 at 16:00)</a>:</h4>
<p><span class="user-mention" data-user-id="119009">@eddyb</span> specifying the msvc windows target for that object should suffice in llc</p>



<a name="181125560"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181125560" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181125560">(Nov 19 2019 at 16:00)</a>:</h4>
<p>I think we have some flexibility otherwise</p>



<a name="181125584"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181125584" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181125584">(Nov 19 2019 at 16:00)</a>:</h4>
<p><span class="user-mention" data-user-id="123586">@nagisa</span> mhmm then how can I make that into a linux executable?</p>



<a name="181125609"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181125609" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181125609">(Nov 19 2019 at 16:01)</a>:</h4>
<p>or link it into one</p>



<a name="181125640"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181125640" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181125640">(Nov 19 2019 at 16:01)</a>:</h4>
<p>I couldn't tell from the assembly that it's going to corrupt the data and trigger the panic</p>



<a name="181125642"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181125642" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181125642">(Nov 19 2019 at 16:01)</a>:</h4>
<p><code>gcc object.o -o out</code> maybe?</p>



<a name="181125680"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181125680" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Hanna Kruppe <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181125680">(Nov 19 2019 at 16:01)</a>:</h4>
<p>That seems too frankenstein to be good for the purpose of demonstrating a bug to upstream. First comment: why the hell does the target triple say windows when you run it on Linux?</p>



<a name="181125777"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181125777" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181125777">(Nov 19 2019 at 16:02)</a>:</h4>
<p>we can give both mingw and native repro <em>shrug</em></p>



<a name="181125900"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181125900" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181125900">(Nov 19 2019 at 16:03)</a>:</h4>
<p>I just wanted to avoid <em>needing</em> mingw + wine, but I think that path would also work</p>



<a name="181125921"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181125921" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181125921">(Nov 19 2019 at 16:03)</a>:</h4>
<p><span class="user-mention" data-user-id="247084">@Siavosh Zarrasvand</span> do you want to spend some time on this? or should I try it? I probably won't get to it until the weekend (unless I'm tempted by how ridiculous this bug is)</p>



<a name="181126039"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181126039" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181126039">(Nov 19 2019 at 16:04)</a>:</h4>
<p><span class="user-mention" data-user-id="124289">@rkruppe</span> <span class="user-mention" data-user-id="123586">@nagisa</span> oh the other thing is that the <code>assert_eq</code> prints the data so you can see it's wrong and corruption has occurred, maybe I should just call <code>printf</code> to show the data and not bother checking for corruption?</p>



<a name="181126295"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181126295" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Hanna Kruppe <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181126295">(Nov 19 2019 at 16:06)</a>:</h4>
<p>Sure, that would work, if the output is not too long or hard to diff by eye. Would probably make the asm shorter, too.</p>



<a name="181126354"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181126354" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181126354">(Nov 19 2019 at 16:07)</a>:</h4>
<p><span class="user-mention" data-user-id="247084">@Siavosh Zarrasvand</span> so yeah maybe you can make a version that just uses <code>printf</code> to show the bytes and even try to get it to be <code>#[no_std]</code> if you want, but that probably doesn't matter much at this point</p>



<a name="181126495"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181126495" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181126495">(Nov 19 2019 at 16:08)</a>:</h4>
<p><span class="user-mention" data-user-id="124289">@rkruppe</span> it's like <code>([11; 8], [22; 8], [33; 8], [44; 8])</code> right now</p>



<a name="181126506"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181126506" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Siavosh Zarrasvand <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181126506">(Nov 19 2019 at 16:08)</a>:</h4>
<blockquote>
<p><span class="user-mention silent" data-user-id="119009">eddyb</span> specifying the msvc windows target for that object should suffice in llc</p>
</blockquote>
<p>Can't cross-compile for msvc in Ubuntu at least, linker does not exists. I had to use gnu-gcc. See my compile flags.</p>



<a name="181126553"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181126553" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181126553">(Nov 19 2019 at 16:09)</a>:</h4>
<p>yeah the -gnu and -msvc targets both work for this, it's really the windows calling convention that seems to be required</p>



<a name="181126601"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181126601" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Siavosh Zarrasvand <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181126601">(Nov 19 2019 at 16:09)</a>:</h4>
<blockquote>
<p><span class="user-mention silent" data-user-id="247084">Siavosh Zarrasvand</span> do you want to spend some time on this? or should I try it? I probably won't get to it until the weekend (unless I'm tempted by how ridiculous this bug is)</p>
</blockquote>
<p>I intend to spend time on this from Thursday and onwards... <span aria-label="slight smile" class="emoji emoji-1f642" role="img" title="slight smile">:slight_smile:</span> But do not let me block anyone else. Please work on it if you can. I will post all my updates here so that we don't perform redundant work</p>



<a name="181126629"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181126629" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181126629">(Nov 19 2019 at 16:09)</a>:</h4>
<p><span class="user-mention" data-user-id="124289">@rkruppe</span> <span class="user-mention" data-user-id="123586">@nagisa</span> more evil ideas: can I just set the windows calling convention on a function on a non-windows target, or will that generate weird SEH things when it shouldn't?</p>



<a name="181126632"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181126632" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Siavosh Zarrasvand <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181126632">(Nov 19 2019 at 16:09)</a>:</h4>
<p><span class="user-mention" data-user-id="119009">@eddyb</span> Sorry, forgot to tag you on the above message</p>



<a name="181126705"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181126705" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181126705">(Nov 19 2019 at 16:10)</a>:</h4>
<p><span class="user-mention" data-user-id="119009">@eddyb</span> yes you can</p>



<a name="181126714"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181126714" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Hanna Kruppe <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181126714">(Nov 19 2019 at 16:10)</a>:</h4>
<p><span class="user-mention" data-user-id="119009">@eddyb</span> pls stop giving me nightmare fuel</p>



<a name="181126746"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181126746" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Hanna Kruppe <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181126746">(Nov 19 2019 at 16:10)</a>:</h4>
<p>This will just make people look for bugs in these weird-ass bits</p>



<a name="181126787"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181126787" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181126787">(Nov 19 2019 at 16:11)</a>:</h4>
<p>x64 calling convention is universally supported across all targets AFAIK</p>



<a name="181126812"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181126812" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181126812">(Nov 19 2019 at 16:11)</a>:</h4>
<p>and is otherwise very well defined.</p>



<a name="181126827"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181126827" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181126827">(Nov 19 2019 at 16:11)</a>:</h4>
<p>I wish I had fine-grained register control because it looks like the big difference is something to do with xmm6</p>



<a name="181126851"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181126851" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181126851">(Nov 19 2019 at 16:11)</a>:</h4>
<p>(until you reach 128 bit stuff, that is)</p>



<a name="181126860"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181126860" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181126860">(Nov 19 2019 at 16:11)</a>:</h4>
<p>hey wouldn't it be funny if one of the registers was just broken but only windows used it?</p>



<a name="181126952"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181126952" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181126952">(Nov 19 2019 at 16:12)</a>:</h4>
<p><span class="user-mention" data-user-id="119009">@eddyb</span> would be hilarious and I kinda want it to happen just so I can return my ryzen and go get a better one :D</p>



<a name="181126977"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181126977" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181126977">(Nov 19 2019 at 16:12)</a>:</h4>
<p>(presumably broken on the LLVM side, our chances of finding a hardware bug that isn't even limited to AMD Ryzen seem slim to impossible)</p>



<a name="181127004"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181127004" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181127004">(Nov 19 2019 at 16:12)</a>:</h4>
<p><span class="user-mention" data-user-id="123586">@nagisa</span> this repros on anything that doesn't SIGILL</p>



<a name="181127019"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181127019" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181127019">(Nov 19 2019 at 16:12)</a>:</h4>
<p>the generated instructions don't use ymm or zmm AFAICT!</p>



<a name="181127066"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181127066" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Siavosh Zarrasvand <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181127066">(Nov 19 2019 at 16:13)</a>:</h4>
<blockquote>
<p>hey wouldn't it be funny if one of the registers was just broken but only windows used it?</p>
</blockquote>
<p>Does ubuntu PCs on znver1 targets run the binary? if not, wouldn't it be more of a znver1 issue than a windows issue?</p>



<a name="181127105"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181127105" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181127105">(Nov 19 2019 at 16:13)</a>:</h4>
<p>it's just that the Ryzen cost tables + windows calling convention register allocation makes LLVM generate very different machine code</p>



<a name="181127194"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181127194" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Siavosh Zarrasvand <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181127194">(Nov 19 2019 at 16:14)</a>:</h4>
<blockquote>
<p>it's just that the Ryzen cost tables + windows calling convention register allocation makes LLVM generate very different machine code</p>
</blockquote>
<p>Ah, oki, cool <span aria-label="slight smile" class="emoji emoji-1f642" role="img" title="slight smile">:slight_smile:</span></p>



<a name="181127203"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181127203" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181127203">(Nov 19 2019 at 16:14)</a>:</h4>
<p><span class="user-mention" data-user-id="247084">@Siavosh Zarrasvand</span> if you run it under wine, it will run on the CPU, wine only hooks windows APIs at the library level AFAICT</p>



<a name="181129673"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181129673" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vincent Rouillé <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181129673">(Nov 19 2019 at 16:36)</a>:</h4>
<p>Hi, I own an AMD R7 1800X on Windows. If you need anything to help you find the root cause of this issue, just ask.</p>



<a name="181130849"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181130849" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vincent Rouillé <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181130849">(Nov 19 2019 at 16:49)</a>:</h4>
<p>The set of instructions just before core::ptr::real_drop_in_place&lt;syn::derive::DeriveInput&gt; in the example given by novacrazy looks to be the same kind of those I found when I investigated <a href="https://github.com/rust-lang/rust/issues/65618" target="_blank" title="https://github.com/rust-lang/rust/issues/65618">#65618</a></p>



<a name="181131248"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181131248" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181131248">(Nov 19 2019 at 16:54)</a>:</h4>
<p><span class="user-mention" data-user-id="224971">@Vincent Rouillé</span> it's probably better to ignore all of the early investigation because of how simple we were able to make the whole setup (also, it's harder to debug crashes in dylibs loaded by <code>rustc</code>, which is where the original failures were)</p>



<a name="181131292"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181131292" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181131292">(Nov 19 2019 at 16:55)</a>:</h4>
<p>also, I think we sadly run out of problems we need a Windows Ryzen machine for and fell into problems we need a lowest-parts-of-LLVM expert for :(</p>



<a name="181131419"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181131419" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181131419">(Nov 19 2019 at 16:56)</a>:</h4>
<p>if I were to investigate this further I would just install mingw and use that with wine (or try to bypass cross-compilation entirely and just get the windows+znver1 codegen on non-Ryzen linux, which sounds doable)</p>



<a name="181131641"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181131641" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181131641">(Nov 19 2019 at 16:58)</a>:</h4>
<p><span class="user-mention" data-user-id="123586">@nagisa</span> at least with your <code>llc</code> suggestion, we can have no optimization passes run and (presumably) still repro, so I think that's significant?</p>



<a name="181131705"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181131705" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181131705">(Nov 19 2019 at 16:59)</a>:</h4>
<p>and maybe there are some LLVM IR instructions that aren't needed - although I don't look forward to redu- OH</p>



<a name="181131946"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181131946" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181131946">(Nov 19 2019 at 17:02)</a>:</h4>
<p><span class="user-mention" data-user-id="116083">@pnkfelix</span> <span class="user-mention" data-user-id="123586">@nagisa</span> <span class="user-mention" data-user-id="124289">@rkruppe</span> I know how to use <code>bugpoint</code> for this!</p>
<p>have a harness that tests <em>both</em> non-windows and/or non-znver1 and windows+znver1 and only pretends to crash/fail when <em>only</em> windows+znver1 produces the wrong result</p>



<a name="181132034"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181132034" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181132034">(Nov 19 2019 at 17:02)</a>:</h4>
<p>you couldn't just look at one of those situations because that would make <code>bugpoint</code> be super helpful and replace the SIMD corruption with something arbitrary that looks corrupted</p>



<a name="181132198"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181132198" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181132198">(Nov 19 2019 at 17:04)</a>:</h4>
<p>I suspect we shouldn't use any C library calls for this, but rather IR for a <code>#![no_std]</code> <code>staticlib</code> with one exported <code>u64 -&gt; u64</code> function that should behave like the identity function (and I guess you'd use only one of the memory locations that gets corrupted - presumably you can get 3 or so different <code>bugpoint</code> reductions)</p>



<a name="181132560"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181132560" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vincent Rouillé <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181132560">(Nov 19 2019 at 17:09)</a>:</h4>
<p>In the repro case at the end of the issue, did you figure out which instructions are wrong?</p>



<a name="181132863"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181132863" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181132863">(Nov 19 2019 at 17:11)</a>:</h4>
<p>hmm. maybe if you compile the testcase with full debuginfo enabled (<code>-C debuginfo=2</code>) and get lucky with LLVM so it doesn't get optimized out and single-step through the execution, constantly printing all the locals?</p>
<p>cc <span class="user-mention" data-user-id="247084">@Siavosh Zarrasvand</span> you said you wanted to use a debugger on this</p>



<a name="181132873"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181132873" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vincent Rouillé <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181132873">(Nov 19 2019 at 17:11)</a>:</h4>
<p>From what I just saw: [3u8;8] is stored in rdi and untouched<br>
([1u8;8], [2u8;8]) is stored in xmm6 and is overwritten by <code>vmovups     ymm6,ymmword ptr [rsp+0B0h]</code></p>



<a name="181132933"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181132933" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181132933">(Nov 19 2019 at 17:12)</a>:</h4>
<p>ooor someone more patient than me can read through the assembly :)</p>



<a name="181132963"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181132963" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181132963">(Nov 19 2019 at 17:12)</a>:</h4>
<p>wait I thought ymm wasn't used, only xmm. maybe I wasn't paying attention</p>



<a name="181133153"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181133153" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181133153">(Nov 19 2019 at 17:14)</a>:</h4>
<p>oh I was looking at <code>vmovaps xmm6, xmmword ptr [rip + .LCPI5_0]</code> and missed all the other instructions using <code>ymm</code></p>



<a name="181133247"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181133247" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vincent Rouillé <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181133247">(Nov 19 2019 at 17:15)</a>:</h4>
<div class="codehilite"><pre><span></span><span class="mi">00007</span><span class="n">FF7F4A61358</span><span class="w">  </span><span class="n">vmovaps</span><span class="w">     </span><span class="n">xmm6</span><span class="p">,</span><span class="n">xmmword</span><span class="w"> </span><span class="n">ptr</span><span class="w"> </span><span class="p">[</span><span class="n">__xmm</span><span class="o">@</span><span class="mi">02020202020202020101010101010101</span><span class="w"> </span><span class="p">(</span><span class="mi">07</span><span class="n">FF7F4A7A000h</span><span class="p">)]</span><span class="w"></span>
<span class="c1">//                            ^ put ([1u8;8], [2u8;8]) into xmm6</span>
<span class="mi">00007</span><span class="n">FF7F4A61360</span><span class="w">  </span><span class="n">lea</span><span class="w">         </span><span class="n">rsi</span><span class="p">,[</span><span class="n">rsp</span><span class="o">+</span><span class="mi">80</span><span class="n">h</span><span class="p">]</span><span class="w"></span>
<span class="mi">00007</span><span class="n">FF7F4A61368</span><span class="w">  </span><span class="n">mov</span><span class="w">         </span><span class="n">rdi</span><span class="p">,</span><span class="mi">303030303030303</span><span class="n">h</span><span class="w"></span>
<span class="c1">//                            ^ put [3u8;8] into rdi</span>
<span class="mi">00007</span><span class="n">FF7F4A61372</span><span class="w">  </span><span class="n">nop</span><span class="w">         </span><span class="n">word</span><span class="w"> </span><span class="n">ptr</span><span class="w"> </span><span class="n">cs</span>:<span class="p">[</span><span class="n">rax</span><span class="o">+</span><span class="n">rax</span><span class="p">]</span><span class="w"></span>
<span class="w">                </span><span class="p">}</span><span class="w"></span>
<span class="w">                </span><span class="n">Evil</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">                    </span><span class="n">data</span>: <span class="p">([</span><span class="mi">1</span><span class="p">;</span><span class="w"> </span><span class="mi">8</span><span class="p">],</span><span class="w"> </span><span class="p">[</span><span class="mi">2</span><span class="p">;</span><span class="w"> </span><span class="mi">8</span><span class="p">],</span><span class="w"> </span><span class="p">[</span><span class="mi">3</span><span class="p">;</span><span class="w"> </span><span class="mi">8</span><span class="p">]),</span><span class="w"></span>
<span class="w">                    </span><span class="n">padding</span>: <span class="nc">MaybeUninit</span>::<span class="n">uninit</span><span class="p">(),</span><span class="w"></span>
<span class="w">                </span><span class="p">}</span><span class="w"></span>
<span class="w">            </span><span class="p">};</span><span class="w"></span>
<span class="w">            </span><span class="kd">let</span><span class="w"> </span><span class="n">evil2</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">evil1</span><span class="p">;</span><span class="w"></span>
<span class="mi">00007</span><span class="n">FF7F4A61380</span><span class="w">  </span><span class="n">vmovups</span><span class="w">     </span><span class="n">ymm0</span><span class="p">,</span><span class="n">ymmword</span><span class="w"> </span><span class="n">ptr</span><span class="w"> </span><span class="p">[</span><span class="n">rsp</span><span class="o">+</span><span class="mi">140</span><span class="n">h</span><span class="p">]</span><span class="w"></span>
<span class="mi">00007</span><span class="n">FF7F4A61389</span><span class="w">  </span><span class="n">vmovups</span><span class="w">     </span><span class="n">ymm1</span><span class="p">,</span><span class="n">ymmword</span><span class="w"> </span><span class="n">ptr</span><span class="w"> </span><span class="p">[</span><span class="n">rsp</span><span class="o">+</span><span class="mi">130</span><span class="n">h</span><span class="p">]</span><span class="w"></span>
<span class="mi">00007</span><span class="n">FF7F4A61392</span><span class="w">  </span><span class="n">vmovups</span><span class="w">     </span><span class="n">ymm6</span><span class="p">,</span><span class="n">ymmword</span><span class="w"> </span><span class="n">ptr</span><span class="w"> </span><span class="p">[</span><span class="n">rsp</span><span class="o">+</span><span class="mi">0</span><span class="n">B0h</span><span class="p">]</span><span class="w"></span>
<span class="c1">//                            ^ overwrite xmm6</span>
<span class="mi">00007</span><span class="n">FF7F4A6139B</span><span class="w">  </span><span class="n">vmovups</span><span class="w">     </span><span class="n">ymm2</span><span class="p">,</span><span class="n">ymmword</span><span class="w"> </span><span class="n">ptr</span><span class="w"> </span><span class="p">[</span><span class="n">rsp</span><span class="o">+</span><span class="mi">0</span><span class="n">F0h</span><span class="p">]</span><span class="w"></span>
<span class="mi">00007</span><span class="n">FF7F4A613A4</span><span class="w">  </span><span class="n">vmovups</span><span class="w">     </span><span class="n">ymm3</span><span class="p">,</span><span class="n">ymmword</span><span class="w"> </span><span class="n">ptr</span><span class="w"> </span><span class="p">[</span><span class="n">rsp</span><span class="o">+</span><span class="mi">110</span><span class="n">h</span><span class="p">]</span><span class="w"></span>
<span class="w">        </span><span class="kd">let</span><span class="w"> </span><span class="n">allocated</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">opaque_iter_next</span><span class="p">(</span><span class="o">&amp;</span><span class="k">mut</span><span class="w"> </span><span class="n">allocator</span><span class="p">).</span><span class="n">unwrap</span><span class="p">();</span><span class="w"></span>
<span class="mi">00007</span><span class="n">FF7F4A613AD</span><span class="w">  </span><span class="n">mov</span><span class="w">         </span><span class="n">rcx</span><span class="p">,</span><span class="n">rsi</span><span class="w"></span>
<span class="w">                </span><span class="p">}</span><span class="w"></span>
<span class="w">                </span><span class="n">Evil</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">                    </span><span class="n">data</span>: <span class="p">([</span><span class="mi">1</span><span class="p">;</span><span class="w"> </span><span class="mi">8</span><span class="p">],</span><span class="w"> </span><span class="p">[</span><span class="mi">2</span><span class="p">;</span><span class="w"> </span><span class="mi">8</span><span class="p">],</span><span class="w"> </span><span class="p">[</span><span class="mi">3</span><span class="p">;</span><span class="w"> </span><span class="mi">8</span><span class="p">]),</span><span class="w"></span>
<span class="w">                    </span><span class="n">padding</span>: <span class="nc">MaybeUninit</span>::<span class="n">uninit</span><span class="p">(),</span><span class="w"></span>
<span class="w">                </span><span class="p">}</span><span class="w"></span>
<span class="w">            </span><span class="p">};</span><span class="w"></span>
<span class="w">            </span><span class="kd">let</span><span class="w"> </span><span class="n">evil2</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">evil1</span><span class="p">;</span><span class="w"></span>
<span class="mi">00007</span><span class="n">FF7F4A613B0</span><span class="w">  </span><span class="n">vmovups</span><span class="w">     </span><span class="n">ymmword</span><span class="w"> </span><span class="n">ptr</span><span class="w"> </span><span class="p">[</span><span class="n">rsp</span><span class="o">+</span><span class="mi">1</span><span class="n">F0h</span><span class="p">],</span><span class="n">ymm0</span><span class="w"></span>
<span class="mi">00007</span><span class="n">FF7F4A613B9</span><span class="w">  </span><span class="n">vmovups</span><span class="w">     </span><span class="n">ymmword</span><span class="w"> </span><span class="n">ptr</span><span class="w"> </span><span class="p">[</span><span class="n">rsp</span><span class="o">+</span><span class="mf">1E0</span><span class="n">h</span><span class="p">],</span><span class="n">ymm1</span><span class="w"></span>
<span class="mi">00007</span><span class="n">FF7F4A613C2</span><span class="w">  </span><span class="n">vmovups</span><span class="w">     </span><span class="n">ymm1</span><span class="p">,</span><span class="n">ymmword</span><span class="w"> </span><span class="n">ptr</span><span class="w"> </span><span class="p">[</span><span class="n">rsp</span><span class="o">+</span><span class="mi">0</span><span class="n">D0h</span><span class="p">]</span><span class="w"></span>
<span class="mi">00007</span><span class="n">FF7F4A613CB</span><span class="w">  </span><span class="n">vmovups</span><span class="w">     </span><span class="n">ymmword</span><span class="w"> </span><span class="n">ptr</span><span class="w"> </span><span class="p">[</span><span class="n">rsp</span><span class="o">+</span><span class="mi">1</span><span class="n">C0h</span><span class="p">],</span><span class="n">ymm3</span><span class="w"></span>
<span class="mi">00007</span><span class="n">FF7F4A613D4</span><span class="w">  </span><span class="n">vmovups</span><span class="w">     </span><span class="n">ymmword</span><span class="w"> </span><span class="n">ptr</span><span class="w"> </span><span class="p">[</span><span class="n">rsp</span><span class="o">+</span><span class="mi">1</span><span class="n">A0h</span><span class="p">],</span><span class="n">ymm2</span><span class="w"></span>
<span class="mi">00007</span><span class="n">FF7F4A613DD</span><span class="w">  </span><span class="n">vmovups</span><span class="w">     </span><span class="n">ymmword</span><span class="w"> </span><span class="n">ptr</span><span class="w"> </span><span class="p">[</span><span class="n">rsp</span><span class="o">+</span><span class="mi">160</span><span class="n">h</span><span class="p">],</span><span class="n">ymm6</span><span class="w"></span>
<span class="w">            </span><span class="n">evil2</span><span class="w"></span>
<span class="w">        </span><span class="p">};</span><span class="w"></span>
<span class="w">        </span><span class="kd">let</span><span class="w"> </span><span class="n">evil4</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">evil3</span><span class="p">;</span><span class="w"></span>
<span class="mi">00007</span><span class="n">FF7F4A613E6</span><span class="w">  </span><span class="n">vmovups</span><span class="w">     </span><span class="n">ymmword</span><span class="w"> </span><span class="n">ptr</span><span class="w"> </span><span class="p">[</span><span class="n">rsp</span><span class="o">+</span><span class="mi">110</span><span class="n">h</span><span class="p">],</span><span class="n">ymm3</span><span class="w"></span>
<span class="mi">00007</span><span class="n">FF7F4A613EF</span><span class="w">  </span><span class="n">vmovups</span><span class="w">     </span><span class="n">ymmword</span><span class="w"> </span><span class="n">ptr</span><span class="w"> </span><span class="p">[</span><span class="n">rsp</span><span class="o">+</span><span class="mi">0</span><span class="n">F0h</span><span class="p">],</span><span class="n">ymm2</span><span class="w"></span>
<span class="mi">00007</span><span class="n">FF7F4A613F8</span><span class="w">  </span><span class="n">vmovups</span><span class="w">     </span><span class="n">ymmword</span><span class="w"> </span><span class="n">ptr</span><span class="w"> </span><span class="p">[</span><span class="n">rsp</span><span class="o">+</span><span class="mi">0</span><span class="n">B0h</span><span class="p">],</span><span class="n">ymm6</span><span class="w"></span>
<span class="w">                </span><span class="p">}</span><span class="w"></span>
<span class="w">                </span><span class="n">Evil</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">                    </span><span class="n">data</span>: <span class="p">([</span><span class="mi">1</span><span class="p">;</span><span class="w"> </span><span class="mi">8</span><span class="p">],</span><span class="w"> </span><span class="p">[</span><span class="mi">2</span><span class="p">;</span><span class="w"> </span><span class="mi">8</span><span class="p">],</span><span class="w"> </span><span class="p">[</span><span class="mi">3</span><span class="p">;</span><span class="w"> </span><span class="mi">8</span><span class="p">]),</span><span class="w"></span>
<span class="w">                    </span><span class="n">padding</span>: <span class="nc">MaybeUninit</span>::<span class="n">uninit</span><span class="p">(),</span><span class="w"></span>
<span class="w">                </span><span class="p">}</span><span class="w"></span>
<span class="w">            </span><span class="p">};</span><span class="w"></span>
<span class="w">            </span><span class="kd">let</span><span class="w"> </span><span class="n">evil2</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">evil1</span><span class="p">;</span><span class="w"></span>
<span class="mi">00007</span><span class="n">FF7F4A61401</span><span class="w">  </span><span class="n">vmovups</span><span class="w">     </span><span class="n">ymmword</span><span class="w"> </span><span class="n">ptr</span><span class="w"> </span><span class="p">[</span><span class="n">rsp</span><span class="o">+</span><span class="mi">180</span><span class="n">h</span><span class="p">],</span><span class="n">ymm1</span><span class="w"></span>
<span class="w">            </span><span class="n">evil2</span><span class="w"></span>
<span class="w">        </span><span class="p">};</span><span class="w"></span>
<span class="w">        </span><span class="kd">let</span><span class="w"> </span><span class="n">evil4</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">evil3</span><span class="p">;</span><span class="w"></span>
<span class="mi">00007</span><span class="n">FF7F4A6140A</span><span class="w">  </span><span class="n">vmovups</span><span class="w">     </span><span class="n">ymmword</span><span class="w"> </span><span class="n">ptr</span><span class="w"> </span><span class="p">[</span><span class="n">rsp</span><span class="o">+</span><span class="mi">0</span><span class="n">D0h</span><span class="p">],</span><span class="n">ymm1</span><span class="w"></span>
<span class="mi">00007</span><span class="n">FF7F4A61413</span><span class="w">  </span><span class="n">vmovups</span><span class="w">     </span><span class="n">ymm5</span><span class="p">,</span><span class="n">ymmword</span><span class="w"> </span><span class="n">ptr</span><span class="w"> </span><span class="p">[</span><span class="n">rsp</span><span class="o">+</span><span class="mi">1</span><span class="n">F0h</span><span class="p">]</span><span class="w"></span>
<span class="mi">00007</span><span class="n">FF7F4A6141C</span><span class="w">  </span><span class="n">vmovups</span><span class="w">     </span><span class="n">ymm4</span><span class="p">,</span><span class="n">ymmword</span><span class="w"> </span><span class="n">ptr</span><span class="w"> </span><span class="p">[</span><span class="n">rsp</span><span class="o">+</span><span class="mf">1E0</span><span class="n">h</span><span class="p">]</span><span class="w"></span>
<span class="mi">00007</span><span class="n">FF7F4A61425</span><span class="w">  </span><span class="n">vmovups</span><span class="w">     </span><span class="n">ymmword</span><span class="w"> </span><span class="n">ptr</span><span class="w"> </span><span class="p">[</span><span class="n">rsp</span><span class="o">+</span><span class="mi">140</span><span class="n">h</span><span class="p">],</span><span class="n">ymm5</span><span class="w"></span>
<span class="mi">00007</span><span class="n">FF7F4A6142E</span><span class="w">  </span><span class="n">vmovups</span><span class="w">     </span><span class="n">ymmword</span><span class="w"> </span><span class="n">ptr</span><span class="w"> </span><span class="p">[</span><span class="n">rsp</span><span class="o">+</span><span class="mi">130</span><span class="n">h</span><span class="p">],</span><span class="n">ymm4</span><span class="w"></span>
<span class="w">        </span><span class="kd">let</span><span class="w"> </span><span class="n">allocated</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">opaque_iter_next</span><span class="p">(</span><span class="o">&amp;</span><span class="k">mut</span><span class="w"> </span><span class="n">allocator</span><span class="p">).</span><span class="n">unwrap</span><span class="p">();</span><span class="w"></span>
<span class="mi">00007</span><span class="n">FF7F4A61437</span><span class="w">  </span><span class="n">vzeroupper</span><span class="w"></span>
<span class="mi">00007</span><span class="n">FF7F4A6143A</span><span class="w">  </span><span class="n">call</span><span class="w">        </span><span class="n">rust_63959</span>::<span class="n">opaque_iter_next</span><span class="o">&lt;</span><span class="k">mut</span><span class="w"> </span><span class="n">core</span>::<span class="n">mem</span>::<span class="n">maybe_uninit</span>::<span class="n">MaybeUninit</span><span class="o">&lt;</span><span class="n">rust_63959</span>::<span class="n">Evil</span><span class="o">&gt;*</span><span class="p">,</span><span class="n">core</span>::<span class="n">slice</span>::<span class="n">IterMut</span><span class="o">&lt;</span><span class="n">core</span>::<span class="n">mem</span>::<span class="n">maybe_uninit</span>::<span class="n">MaybeUninit</span><span class="o">&lt;</span><span class="n">rust_63959</span>::<span class="n">Evil</span><span class="o">&gt;&gt;&gt;</span><span class="w"> </span><span class="p">(</span><span class="mi">07</span><span class="n">FF7F4A612F0h</span><span class="p">)</span><span class="w"></span>
<span class="mi">00007</span><span class="n">FF7F4A6143F</span><span class="w">  </span><span class="n">test</span><span class="w">        </span><span class="n">rax</span><span class="p">,</span><span class="n">rax</span><span class="w"></span>
<span class="mi">00007</span><span class="n">FF7F4A61442</span><span class="w">  </span><span class="n">je</span><span class="w">          </span><span class="n">rust_63959</span>::<span class="n">main</span><span class="o">+</span><span class="mi">213</span><span class="n">h</span><span class="w"> </span><span class="p">(</span><span class="mi">07</span><span class="n">FF7F4A61523h</span><span class="p">)</span><span class="w"></span>
<span class="w">        </span><span class="kd">let</span><span class="w"> </span><span class="n">data</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="o">&amp;</span><span class="n">allocated</span><span class="p">.</span><span class="n">write</span><span class="p">(</span><span class="n">evil4</span><span class="p">).</span><span class="n">data</span><span class="p">;</span><span class="w"></span>
<span class="mi">00007</span><span class="n">FF7F4A61448</span><span class="w">  </span><span class="n">vmovups</span><span class="w">     </span><span class="n">xmmword</span><span class="w"> </span><span class="n">ptr</span><span class="w"> </span><span class="p">[</span><span class="n">rax</span><span class="p">],</span><span class="n">xmm6</span><span class="w"></span>
<span class="c1">//                            ^ put xmm6 (i.e. garbage)  into [rax]</span>
<span class="w">        </span><span class="kd">let</span><span class="w"> </span><span class="n">data</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="o">&amp;</span><span class="n">allocated</span><span class="p">.</span><span class="n">write</span><span class="p">(</span><span class="n">evil4</span><span class="p">).</span><span class="n">data</span><span class="p">;</span><span class="w"></span>
<span class="mi">00007</span><span class="n">FF7F4A6144C</span><span class="w">  </span><span class="n">mov</span><span class="w">         </span><span class="n">qword</span><span class="w"> </span><span class="n">ptr</span><span class="w"> </span><span class="p">[</span><span class="n">rax</span><span class="o">+</span><span class="mi">10</span><span class="n">h</span><span class="p">],</span><span class="n">rdi</span><span class="w"></span>
<span class="c1">//                            ^ put rdi (i.e. [3u8;8])  into [rax+10h]</span>
</pre></div>



<a name="181133252"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181133252" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181133252">(Nov 19 2019 at 17:15)</a>:</h4>
<p><a href="https://godbolt.org/z/KmMdZD" target="_blank" title="https://godbolt.org/z/KmMdZD">https://godbolt.org/z/KmMdZD</a> is the relevant output ftr</p>



<a name="181133309"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181133309" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vincent Rouillé <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181133309">(Nov 19 2019 at 17:16)</a>:</h4>
<p>it's easier to find where the data flow with a debugger :)</p>



<a name="181133448"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181133448" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181133448">(Nov 19 2019 at 17:17)</a>:</h4>
<p>I remember seeing an output like what you pasted there from a tool, ages ago, but I forget what it was</p>



<a name="181133519"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181133519" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181133519">(Nov 19 2019 at 17:18)</a>:</h4>
<p>and I've forgotten it's a thing at all</p>



<a name="181133530"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181133530" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vincent Rouillé <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181133530">(Nov 19 2019 at 17:18)</a>:</h4>
<p>The heavy visual studio...</p>



<a name="181133551"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181133551" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181133551">(Nov 19 2019 at 17:18)</a>:</h4>
<p>ah that would explain it</p>



<a name="181133563"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181133563" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181133563">(Nov 19 2019 at 17:18)</a>:</h4>
<p><span class="user-mention" data-user-id="224971">@Vincent Rouillé</span> well, that gives me a pretty good idea of one way this might happen</p>



<a name="181133625"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181133625" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181133625">(Nov 19 2019 at 17:19)</a>:</h4>
<p><span class="user-mention" data-user-id="124289">@rkruppe</span> <span class="user-mention" data-user-id="123586">@nagisa</span> <span class="user-mention" data-user-id="133224">@Nikita Popov</span> do you think it's possible for LLVM to miss a conflict between <code>xmmN</code> and <code>ymmN</code>?</p>



<a name="181133818"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181133818" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181133818">(Nov 19 2019 at 17:21)</a>:</h4>
<p>the non-windows znver1 codegen uses <code>0x0303030303030303</code> in <code>r14</code> (<strong>EDIT</strong>: nevermind, <code>rdi</code> is used to hold that constant in the windows version, <em>not</em> <code>xmm6</code>)</p>



<a name="181133844"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181133844" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181133844">(Nov 19 2019 at 17:21)</a>:</h4>
<p>oh wow it still uses <code>ymm6</code>, ugh I should've paid more attention to the actual diff between those two</p>



<a name="181133916"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181133916" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181133916">(Nov 19 2019 at 17:22)</a>:</h4>
<p>so if I ignore the stack offsets, the use of <code>xmm6</code> is the main difference</p>



<a name="181134029"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181134029" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181134029">(Nov 19 2019 at 17:23)</a>:</h4>
<p>and <code>vmovaps xmm0, xmmword ptr [rip + .LCPI5_0]</code> being immediately followed by using <code>xmm0</code>, in the non-windows version</p>



<a name="181134235"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181134235" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181134235">(Nov 19 2019 at 17:25)</a>:</h4>
<p>both versions freely use all <code>ymm</code> registers, so I'm not sure I understand what in the calling convention makes windows use <code>xmm6</code>?!</p>



<a name="181134324"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181134324" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181134324">(Nov 19 2019 at 17:26)</a>:</h4>
<p>the windows version appears to have to save and restore <code>xmm6</code>, which may be the calling convention difference, but that wouldn't explain why it uses it for anything else</p>



<a name="181134618"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181134618" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181134618">(Nov 19 2019 at 17:29)</a>:</h4>
<p>okay I've taken a closer look and it's <code>vmovaps xmmN, xmmword ptr [rip + .LCPI5_0]</code> in both, <em>but</em> both the N and the location of the instruction differs:</p>
<ul>
<li>non-windows loads <code>xmm0</code> right before using it</li>
<li>windows loads <code>xmm6</code> <em>much earlier</em></li>
</ul>



<a name="181134659"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181134659" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vincent Rouillé <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181134659">(Nov 19 2019 at 17:29)</a>:</h4>
<p>in godbolt, the linux (left) is writing ([1u8;8],[2u8;8]) into xmm0 later than the windows (right) version</p>



<a name="181134750"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181134750" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vincent Rouillé <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181134750">(Nov 19 2019 at 17:30)</a>:</h4>
<p>yeah same conclusion</p>



<a name="181134755"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181134755" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181134755">(Nov 19 2019 at 17:30)</a>:</h4>
<p>there is the uninlined <code>opaque_iter_next</code> call in between, I wonder if on windows <code>xmm6</code> <em>specifically</em> is callee-saved, but on non-windows there are no callee-saved xmm registers?</p>



<a name="181134815"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181134815" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181134815">(Nov 19 2019 at 17:31)</a>:</h4>
<p>so on windows it tries to aggressively take advantage of that one callee-saved register?</p>



<a name="181134863"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181134863" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181134863">(Nov 19 2019 at 17:31)</a>:</h4>
<p>well, there goes my bugpoint harness, we can probably reduce the LLVM by hand now taking into account that one register usage</p>



<a name="181135484"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181135484" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181135484">(Nov 19 2019 at 17:38)</a>:</h4>
<p><span class="user-mention" data-user-id="116083">@pnkfelix</span> <span class="user-mention" data-user-id="124289">@rkruppe</span> I should not trust my intuition with regards to why the size matters, this isn't even a stack corruption but register corruption... (before I managed to remove allocation was assuming it was an allocator size class, lol)</p>



<a name="181135585"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181135585" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181135585">(Nov 19 2019 at 17:39)</a>:</h4>
<p>so I think I know where that large size is coming from too! one <code>ymm</code> register is 4 <code>u64</code>s, so you need at least <code>4*6+1</code> <code>u64</code>s for <code>ymm6</code> to be needed, that's 25. 3 of them are in <code>data</code>,  and <code>22</code> are in <code>padding</code></p>



<a name="181135654"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181135654" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181135654">(Nov 19 2019 at 17:40)</a>:</h4>
<blockquote>
<p><span class="user-mention silent" data-user-id="124289">rkruppe</span> <span class="user-mention silent" data-user-id="123586">nagisa</span> <span class="user-mention silent" data-user-id="133224">Nikita Popov</span> do you think it's possible for LLVM to miss a conflict between <code>xmmN</code> and <code>ymmN</code>?</p>
</blockquote>
<p>Hard to imagine this being a cae.</p>



<a name="181135725"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181135725" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181135725">(Nov 19 2019 at 17:41)</a>:</h4>
<p>FWIW microsoft’s x86 calling convention only uses xmm0-3 in its calling convention</p>



<a name="181135843"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181135843" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181135843">(Nov 19 2019 at 17:42)</a>:</h4>
<p>it only treats xmm6 as callee-save despite using ymm0-ymm6 (maybe ymm7 is also callee-save? I should check)</p>



<a name="181135892"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181135892" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181135892">(Nov 19 2019 at 17:42)</a>:</h4>
<p>xmm6-xmm15 are non-volatile registers, so it might be a case of it failing to spill/restore it right if it overwrites it</p>



<a name="181135958"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181135958" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vincent Rouillé <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181135958">(Nov 19 2019 at 17:43)</a>:</h4>
<p>by the way target-cpu=core-avx2, doesn't have this problem, it still write to xmm6, but do not use ymm6.</p>



<a name="181135976"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181135976" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181135976">(Nov 19 2019 at 17:43)</a>:</h4>
<blockquote>
<p>the upper portions of YMM0-15 and ZMM0-15 are considered volatile and must be considered destroyed on function calls</p>
</blockquote>
<p>also as per the docs.</p>



<a name="181136071"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181136071" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181136071">(Nov 19 2019 at 17:44)</a>:</h4>
<p><span class="user-mention" data-user-id="224971">@Vincent Rouillé</span> I think that's where the znver1 cost tables come in, it's supposedly faster/more efficient on Ryzens to do what LLVM is doing here</p>



<a name="181136141"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181136141" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181136141">(Nov 19 2019 at 17:45)</a>:</h4>
<p><span class="user-mention" data-user-id="123586">@nagisa</span> okay with 22+2*4 for the padding length I can see xmm7 and xmm8 also getting callee-saved</p>



<a name="181136166"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181136166" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181136166">(Nov 19 2019 at 17:45)</a>:</h4>
<p>above that it crosses a threshold and uses memcpy or something</p>



<a name="181136461"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181136461" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vincent Rouillé <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181136461">(Nov 19 2019 at 17:49)</a>:</h4>
<p>it's funny to see that at 32, it stops using ymm6 and use ymm7</p>



<a name="181136666"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181136666" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181136666">(Nov 19 2019 at 17:52)</a>:</h4>
<p>I summarized everything so far into <a href="https://github.com/rust-lang/rust/issues/63959#issuecomment-555627472" target="_blank" title="https://github.com/rust-lang/rust/issues/63959#issuecomment-555627472">https://github.com/rust-lang/rust/issues/63959#issuecomment-555627472</a></p>



<a name="181136894"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181136894" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181136894">(Nov 19 2019 at 17:54)</a>:</h4>
<p><span class="user-mention" data-user-id="123586">@nagisa</span> found at least where this is declared <a href="https://github.com/llvm/llvm-project/blob/e531750c6cf9ab6ca987ffbfe100b1d766269eb5/llvm/lib/Target/X86/X86CallingConv.td#L1071-L1072" target="_blank" title="https://github.com/llvm/llvm-project/blob/e531750c6cf9ab6ca987ffbfe100b1d766269eb5/llvm/lib/Target/X86/X86CallingConv.td#L1071-L1072">https://github.com/llvm/llvm-project/blob/e531750c6cf9ab6ca987ffbfe100b1d766269eb5/llvm/lib/Target/X86/X86CallingConv.td#L1071-L1072</a></p>



<a name="181136911"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181136911" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181136911">(Nov 19 2019 at 17:54)</a>:</h4>
<p>now that I know what to look for :D</p>



<a name="181137183"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181137183" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181137183">(Nov 19 2019 at 17:57)</a>:</h4>
<p>non-windows doesn't appear to have xmm callee-saved registers, at all? (there are some exceptions i.e. "regcall". hmmmmmmmm)</p>



<a name="181137314"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181137314" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181137314">(Nov 19 2019 at 17:59)</a>:</h4>
<p>we don't expose regcall in Rust?</p>



<a name="181137491"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181137491" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181137491">(Nov 19 2019 at 18:00)</a>:</h4>
<p>wait, now that we know it's the <code>opaque_iter_next</code>.... <code>extern "win64" fn opaque_iter_next</code> works on non-windows and produces very similar ASM...</p>



<a name="181138026"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181138026" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181138026">(Nov 19 2019 at 18:06)</a>:</h4>
<p>yes it reproduces trivially on linux now (and probably anything at all, really) - see <a href="https://github.com/rust-lang/rust/issues/63959#issuecomment-555633777" target="_blank" title="https://github.com/rust-lang/rust/issues/63959#issuecomment-555633777">https://github.com/rust-lang/rust/issues/63959#issuecomment-555633777</a></p>



<a name="181138119"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181138119" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181138119">(Nov 19 2019 at 18:07)</a>:</h4>
<p>I need to go grab something to eat but this feels like a big step</p>



<a name="181138851"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181138851" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181138851">(Nov 19 2019 at 18:15)</a>:</h4>
<p>should be trivial at this point to get to a LLVM-IR to report upstream</p>



<a name="181138985"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181138985" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mati865 <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181138985">(Nov 19 2019 at 18:16)</a>:</h4>
<p>For previous questions:<br>
It's definitely <strong>not</strong> a hardware bug. You can reproduce crash on any CPU that has necessary registers/instructions.<br>
This code works fine on Linux with 2nd gen Ryzen CPU.<br>
I tried to use bugpoint but it appears to not work at all on windows.</p>



<a name="181139032"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181139032" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181139032">(Nov 19 2019 at 18:16)</a>:</h4>
<p><span class="user-mention" data-user-id="119581">@mati865</span> now that reproducer works on linux, should be viable to use it</p>



<a name="181139063"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181139063" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mati865 <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181139063">(Nov 19 2019 at 18:17)</a>:</h4>
<p>Oh, neat!</p>



<a name="181139387"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181139387" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181139387">(Nov 19 2019 at 18:21)</a>:</h4>
<blockquote>
<p><span class="user-mention silent" data-user-id="116083">pnkfelix</span> <span class="user-mention silent" data-user-id="123586">nagisa</span> <span class="user-mention silent" data-user-id="124289">rkruppe</span> I know how to use <code>bugpoint</code> for this!</p>
<p>have a harness that tests <em>both</em> non-windows and/or non-znver1 and windows+znver1 and only pretends to crash/fail when <em>only</em> windows+znver1 produces the wrong result</p>
</blockquote>
<p>you still need something like this ^^</p>



<a name="181139393"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181139393" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181139393">(Nov 19 2019 at 18:21)</a>:</h4>
<p>if you want to use <code>bugpoint</code></p>



<a name="181139478"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181139478" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181139478">(Nov 19 2019 at 18:22)</a>:</h4>
<p>but at least this time it can be an entirely linux-based procedure, and you just toggle whether <code>opaque_id</code> has <code>win64</code> calling convention or not</p>



<a name="181139525"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181139525" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mati865 <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181139525">(Nov 19 2019 at 18:22)</a>:</h4>
<p>That's exactly what I did for creduce <span aria-label="upside down" class="emoji emoji-1f643" role="img" title="upside down">:upside_down:</span></p>



<a name="181139531"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181139531" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181139531">(Nov 19 2019 at 18:22)</a>:</h4>
<p>(you'd probably have to inject it into whatever bugpoint gives you, I'm guessing?)</p>



<a name="181139605"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181139605" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181139605">(Nov 19 2019 at 18:24)</a>:</h4>
<p>I've sunk enough time as it is into this, I guess if nobody has taken over in an hour or so I'll do that</p>



<a name="181139847"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181139847" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181139847">(Nov 19 2019 at 18:26)</a>:</h4>
<p>(I guess both win64 and regcall calling conventions could be attempted, I expect results from both, but maybe not identical)</p>



<a name="181139861"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181139861" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mati865 <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181139861">(Nov 19 2019 at 18:26)</a>:</h4>
<p>I'm out of time.<br>
This probably proves <a href="https://github.com/rust-lang/rust/issues/65618" target="_blank" title="https://github.com/rust-lang/rust/issues/65618">#65618</a> is something entirely different?<br>
It works on mingw bug doesn't with msvc.</p>



<a name="181139906"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181139906" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mati865 <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181139906">(Nov 19 2019 at 18:27)</a>:</h4>
<p>And is also related to znver1.</p>



<a name="181139937"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181139937" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181139937">(Nov 19 2019 at 18:27)</a>:</h4>
<p>could very well be more of the same.</p>



<a name="181140005"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181140005" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181140005">(Nov 19 2019 at 18:28)</a>:</h4>
<p>yeah just more sensitive to certain things</p>



<a name="181140234"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181140234" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mati865 <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181140234">(Nov 19 2019 at 18:30)</a>:</h4>
<p>Shouldn't it reproduce on windows with mingw then?<br>
Or maybe there is some platform specific code somewhere along.</p>



<a name="181158567"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181158567" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nikita Popov <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181158567">(Nov 19 2019 at 21:57)</a>:</h4>
<p>Looking through debug logs, it looks like originally a correct register allocation is produced, but then critical anti-dep edge breaking replaces a ymm0 use with a conflicting ymm6 use.</p>



<a name="181158596"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181158596" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181158596">(Nov 19 2019 at 21:57)</a>:</h4>
<p>ymm0 -&gt; ymm6? not xmm0 -&gt; xmm6?</p>



<a name="181158677"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181158677" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181158677">(Nov 19 2019 at 21:58)</a>:</h4>
<p>because xmm0 <em>is</em> being used when xmm6 is not available due to being callee-saved, so it would make sense that xmm0 -&gt; xmm6 happens with win64 (or regcall, if you switch that manually in the IR)</p>



<a name="181847997"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181847997" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181847997">(Nov 25 2019 at 18:14)</a>:</h4>
<p>uhh it's been (far) more than an hour</p>



<a name="181848015"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181848015" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181848015">(Nov 25 2019 at 18:15)</a>:</h4>
<p>but right now I'm reducing bugpoint output</p>



<a name="181848050"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181848050" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181848050">(Nov 25 2019 at 18:15)</a>:</h4>
<p>this is what I've used to get that <a href="https://gist.github.com/eddyb/7b08cdc2ff0a40aed8adcfaf63120598" target="_blank" title="https://gist.github.com/eddyb/7b08cdc2ff0a40aed8adcfaf63120598">https://gist.github.com/eddyb/7b08cdc2ff0a40aed8adcfaf63120598</a></p>



<a name="181848150"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181848150" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181848150">(Nov 25 2019 at 18:16)</a>:</h4>
<p>bugpoint annoyingly leaves a bunch of things <code>undef</code>, which only do anything useful through the sheer power of strong coincidence, but I was able to get rid of it</p>



<a name="181850630"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181850630" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181850630">(Nov 25 2019 at 18:43)</a>:</h4>
<p>wrote it up on thread <a href="https://github.com/rust-lang/rust/issues/63959#issuecomment-558287117" target="_blank" title="https://github.com/rust-lang/rust/issues/63959#issuecomment-558287117">https://github.com/rust-lang/rust/issues/63959#issuecomment-558287117</a></p>



<a name="181850681"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181850681" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181850681">(Nov 25 2019 at 18:44)</a>:</h4>
<p>cc <span class="user-mention" data-user-id="123586">@nagisa</span> <span class="user-mention" data-user-id="133224">@Nikita Popov</span> <span class="user-mention" data-user-id="124289">@rkruppe</span> <del>does anyone volunteer to submit to LLVM?</del> (nevermind, I ended up doing it myself, see below)</p>



<a name="181850728"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181850728" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181850728">(Nov 25 2019 at 18:44)</a>:</h4>
<p>it's been a while for me</p>



<a name="181850818"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181850818" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Hanna Kruppe <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181850818">(Nov 25 2019 at 18:45)</a>:</h4>
<p>I still don't have an LLVM bugzilla account &gt;_&gt;</p>



<a name="181850871"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181850871" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181850871">(Nov 25 2019 at 18:45)</a>:</h4>
<p>oh wait I'm not sure I do, I forgot something happened at some point</p>



<a name="181850990"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181850990" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181850990">(Nov 25 2019 at 18:47)</a>:</h4>
<p>I guess I do, oh well I'll do it</p>



<a name="181854255"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181854255" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181854255">(Nov 25 2019 at 19:22)</a>:</h4>
<p>there we go: <a href="https://bugs.llvm.org/show_bug.cgi?id=44140" target="_blank" title="https://bugs.llvm.org/show_bug.cgi?id=44140">https://bugs.llvm.org/show_bug.cgi?id=44140</a></p>



<a name="181854316"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181854316" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181854316">(Nov 25 2019 at 19:23)</a>:</h4>
<p>sorry for all the delays thus far, this turned out to be far more manageable and not as much of a timesink as I was worrying</p>



<a name="181870204"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181870204" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nikita Popov <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181870204">(Nov 25 2019 at 22:29)</a>:</h4>
<p>Based on ctoppers comment it looks like this is indeed caused by critical anti-dep breaking not handling subregs correctly. Sorry for not following up on that.</p>



<a name="181975539"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/181975539" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#181975539">(Nov 26 2019 at 23:41)</a>:</h4>
<p><span class="user-mention" data-user-id="119009">@eddyb</span> <a href="https://www.phoronix.com/scan.php?page=news_item&amp;px=Linux-5.2-Go-Register-Corrupt" target="_blank" title="https://www.phoronix.com/scan.php?page=news_item&amp;px=Linux-5.2-Go-Register-Corrupt">https://www.phoronix.com/scan.php?page=news_item&amp;px=Linux-5.2-Go-Register-Corrupt</a> in related news.</p>



<a name="182016290"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/182016290" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#182016290">(Nov 27 2019 at 13:03)</a>:</h4>
<p>oof</p>



<a name="182113048"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/182113048" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#182113048">(Nov 28 2019 at 14:30)</a>:</h4>
<p>hey <span class="user-mention" data-user-id="119009">@eddyb</span> given that you've identified this as an LLVM bug, what next for <a href="https://github.com/rust-lang/rust/issues/63959" target="_blank" title="https://github.com/rust-lang/rust/issues/63959">#63959</a> itself? Should I close it as "LLVM bug" ? Or downgrade it to P-medium at least? I don't think it warrants further investigation on our part, right?</p>



<a name="182119707"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/182119707" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#182119707">(Nov 28 2019 at 16:03)</a>:</h4>
<p><span class="user-mention" data-user-id="116083">@pnkfelix</span> I think the issue should be closed by a PR that updates LLVM to include a backport of the fix</p>



<a name="182119784"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/182119784" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#182119784">(Nov 28 2019 at 16:04)</a>:</h4>
<p>oh, right, that's probably the way to go</p>



<a name="182119785"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/182119785" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#182119785">(Nov 28 2019 at 16:04)</a>:</h4>
<p>could be done as soon as the fix lands upstream, or even earlier if we don't want to wait. I wish I knew who also handles stuff like this (i.e. LLVM updates and backports), other than <span class="user-mention" data-user-id="116015">@Alex Crichton</span>. worst case someone ping me and I can probably do it</p>



<a name="182119799"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/182119799" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#182119799">(Nov 28 2019 at 16:05)</a>:</h4>
<p>thanks!</p>



<a name="182119805"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/182119805" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#182119805">(Nov 28 2019 at 16:05)</a>:</h4>
<p>not sure if we have a strategy for backporting LLVM updates due to LLVM backports back to beta</p>



<a name="182119815"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/182119815" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#182119815">(Nov 28 2019 at 16:05)</a>:</h4>
<p>(that was... a mouthful)</p>



<a name="182120046"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/182120046" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mati865 <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#182120046">(Nov 28 2019 at 16:08)</a>:</h4>
<p>Upstream fix landed in llvm master branch already.<br>
AFAIK anybody can open backport PR, even I did it in the past.</p>



<a name="182120286"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/182120286" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#182120286">(Nov 28 2019 at 16:12)</a>:</h4>
<blockquote>
<p>Upstream fix landed in llvm master branch already.</p>
</blockquote>
<p>wheeeee</p>



<a name="182120310"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/182120310" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#182120310">(Nov 28 2019 at 16:12)</a>:</h4>
<p>wait wouldn't the bug report get closed and therefore I should've gotten an email?</p>



<a name="182162756"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/182162756" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mati865 <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#182162756">(Nov 29 2019 at 09:27)</a>:</h4>
<p><span class="user-mention" data-user-id="119009">@eddyb</span>  should I open backport PR (after testing OFC) or do you want to do it?</p>



<a name="182185061"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/182185061" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#182185061">(Nov 29 2019 at 15:17)</a>:</h4>
<p><span class="user-mention" data-user-id="119581">@mati865</span> you can do it, I'm swamped again</p>



<a name="182185114"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Miscompilation%20with%20target-cpu%3Dznver1%20%2363959/near/182185114" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mati865 <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Miscompilation.20with.20target-cpu.3Dznver1.20.2363959.html#182185114">(Nov 29 2019 at 15:18)</a>:</h4>
<p>Sure</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>